package com.example.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.service.CommentService;
import com.example.service.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * @author fangyu
 * @version v1.0.0
 * @date 2020/7/20 10:25 下午
 */
@Controller
public class BaseController {

    @Autowired
    HttpServletRequest request;

    @Autowired
    PostService postService;

    @Autowired
    CommentService commentService;

    public Page getPage() {
        int page = ServletRequestUtils.getIntParameter(request,"page", 1);
        int size = ServletRequestUtils.getIntParameter(request,"size", 5);
        return new Page(page, size);
    }
}
